home *** CD-ROM | disk | FTP | other *** search
- Path: gollum.kingston.net!usenet
- From: girard@haventree.com (Eugene Girard)
- Newsgroups: comp.lang.c++
- Subject: Re: READ THIS!!!!!!!!!!!
- Date: Fri, 16 Feb 1996 17:33:27 GMT
- Organization: HavenTree Software, Limited
- Message-ID: <4g2im5$sv3@gollum.kingston.net>
- References: <4em5fs$a86@ixnews4.ix.netcom.com>
- NNTP-Posting-Host: buddy.haventree.com
- X-Newsreader: Forte Free Agent v0.55
-
- jeremyx@ix.netcom.com(Jeremy Johnston ) wrote:
-
-
- > ok....now that I have your attention i need some help.
- >I can't get the following command to work & the compiler says that the
- >constant has too many characters.
-
- > char dos;
- > if(dos=='dir')
- > goto b;
-
- >How can i do this to get it to work?
-
- Try:
- char *dos;
- ...
- if (strcmp( dos, "dir") == 0)
- goto b;
-
- A few notes:
- 1) You don't need a goto here. Try to stick the appropriate code
- immediately after the if statement. (The rule is: Avoid GOTO's unless
- you have a darn good reason to use them.)
- 2) You can't compare literal strings directly (dos == "dir"), since
- this would test to see if the pointers were pointing to the same
- address. Instead, use a string comparison function.
- 3) Strings are enclosed in double quotes, not single. Single quotes
- are used to define character constants. The real difference is that
- string constants are null-terminated strings, while char constants
- are just the char.
-
- > please help,I know you can.
- Just one more comment. People will be more willing to help if you
- include a reasonable subject for your article. "READ THIS!!!!!!!!" is
- not very informative, and probably not the most polite way of asking
- for help from a group of strangers.
-
-
-
-
- >
-
- --
- Eugene Girard, Programmer, HavenTree Software Limited
- HavenTree makes EasyFlow (Windows, DOS, MAC) and Nodemap (Windows, DOS)
- For more information, check out http://www.haventree.com
-
-